package com.Adapters;


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.Adapters.Items.ItemProfile;
import com.TextFormat.UtilFonts;
import com.shareup.R;


public class PictureListAdapter extends ArrayAdapter<ItemProfile> {

    private ViewHolder holder;

    class ViewHolder {

        public ImageView icon;

        public TextView text;
    }

    public PictureListAdapter(Context context, int resource,
                int textComment) {

        super(context, resource, textComment);
    }

    @Override
    public long getItemId(int position) {

        return 0;
    }

    @Override
    public View getView(int position, View v, ViewGroup parent) {

        holder = null;
        if (v == null) {

            holder = new ViewHolder();

            v = LayoutInflater.from(getContext()).inflate(R.layout.option_picture_text, null);
            holder.text = (TextView) v.findViewById(R.id.text_comment);
            holder.icon = (ImageView) v.findViewById(R.id.row_icon);

            v.setTag(holder);
        }
        else {
            holder = (ViewHolder) v.getTag();
        }

        UtilFonts.setTextRegularFont(holder.text);
        holder.text.setText(this.getItem(position).tag);
        holder.icon.setImageResource(this.getItem(position).iconRes);

        return v;
    }
}
